home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13367 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
  2. From: grantp@usa.pipeline.com(Pete Grant)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Newbie: Creating .a files
  5. Date: 25 Mar 1996 11:25:12 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4j5vqo$ajh@news1.h1.usa.pipeline.com>
  8. References: <Pine.SOL.3.91.960324201800.26556A-100000@vu-vlsi.ee.vill.edu>
  9. NNTP-Posting-Host: 38.8.120.13
  10. X-PipeUser: grantp
  11. X-PipeHub: usa.pipeline.com
  12. X-PipeGCOS: (Pete Grant)
  13. X-Newsreader: Pipeline v3.5.0
  14.  
  15. On Mar 24, 1996 20:18:52 in article <Newbie: Creating .a files>,
  16. 'Senthilvel Rangaswamy <senthil@ece.vill.edu>' wrote: 
  17.  
  18.  
  19. >Could anybody please explain me what is .a file 
  20. >and how to create one from .o files. 
  21.  
  22. First, .o file.  This is an object file produced by your compiler. 
  23. It is binary code, but it is not ready to be run as a standalone 
  24. executable as it is missing certain required header info and is 
  25. incomplete; i.e., 99.99% of the time contains references to external 
  26. definitions.  It is the linker's job to collect all the .o and .a 
  27. files together, resolve all the references, and produce a module 
  28. that can be loaded and run by the OS. 
  29.  
  30. Roughly, .a file is a library (archive) file which is a collection 
  31. of routines that can be linked into your program.  The main dif- 
  32. ference is that the linker, while including everything in a .o file, 
  33. extracts only what it needs out of a .a file, thereby reducing the 
  34. size of your executable considerably.  To serve this end, the .a 
  35. file contains additional info about its contents to enable the  
  36. linker to quickly process archives. 
  37.  
  38. A .a file is produced by the ar processor.  Both .o and .a are 
  39. specific to Unix systems.  Their approximate counterparts on 
  40. Intel platforms are .obj and .lib, respectively. 
  41.  
  42. To create a .a file from .o's on Solaris: 
  43.  
  44.    ar -V ru mylib.a one.o two.o three.o ...etc 
  45.  
  46. Check the man pages on ar for specifics.  The above works 
  47. for me, but the -V isn't really needed. 
  48.  
  49. -- 
  50. Pete Grant 
  51. Kalevi, Inc. 
  52. Software Engineering & development
  53.